* Clean up
clear all

/* Set working directory: please set your own
cd "~/Dropbox/JOP third submission/JOP replication/"
*/


* Open dataset
use 01_data/cses2_3.dta, clear

* Run analyses
regr difference_voter_expert pp_dummy
est store lr_party_1
estadd local  Sample "All parties"

regr difference_voter_expert pp_dummy if cses_wave == 2, cluster(respondent_code)
est store lr_party_2
estadd local  Sample "All parties"

regr difference_voter_expert pp_dummy if cses_wave == 3, cluster(respondent_code)
est store lr_party_3
estadd local  Sample "All parties"

regr difference_voter_expert pp_dummy if center_right == 1, cluster(respondent_code)
est store lr_party_4
estadd local  Sample "Center-right parties"

regr difference_voter_expert pp_dummy if center_right == 1 &  cses_wave == 2, cluster(respondent_code)
est store lr_party_5
estadd local  Sample "Center-right parties"

regr difference_voter_expert pp_dummy if center_right == 1 &  cses_wave == 3, cluster(respondent_code)
est store lr_party_6
estadd local  Sample "Center-right parties"

* Make table
esttab lr_party_1 lr_party_2 lr_party_3 lr_party_4 lr_party_5 lr_party_6 using 03_tables/table2.tex, tex se replace mtitles ("CSES Waves 2 and 3" "CSES Wave 2" "CSES Wave 3" "CSES Waves 2 and 3" "CSES Wave 2" "CSES Wave 3" "CSES Waves 2 and 3" "CSES Wave 2" "CSES Wave 3") keep(pp_dummy _cons) coeflabels (pp_dummy "PP (dummy)" _cons "Constant") s(Sample, label("Sample")) star(* 0.10 ** 0.05 *** 0.01) addnotes("Standard errors are clustered by respondent") scalars(e(N))
